﻿#ifndef EXECONFIG_H
#define EXECONFIG_H

#include <QObject>
#include <QDebug>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QSqlRecord>
#include <QJsonObject>
#include <QJsonArray>
#include <DbHelper.h>
#include <QRandomGenerator>
#include <UdpClient.h>
#include <CommonHelper.h>
#include <qmessagebox.h>
#include <QFileDialog>

class ExeConfig: public QObject
{
    Q_OBJECT
public:
    ExeConfig();
    Q_INVOKABLE  QJsonArray readsypz(int id);
    Q_INVOKABLE  void wsyxx(QString id,QString name, QString type, QString path);

    Q_INVOKABLE QString rsyxx(int id);
    Q_INVOKABLE QJsonArray readsypzlist(QString name);
    Q_INVOKABLE void newsypz();
    Q_INVOKABLE void delsypz(int id);
    Q_INVOKABLE void upall(QString id, QString numv, QString v1, QString v2, QString v3, QString v4, QString v5, QString v6, QString v7, QString v8, QString v9);
    Q_INVOKABLE QStringList readall(QString id, QString numv);
    Q_INVOKABLE void delkj(QString id, QString numv);
    Q_INVOKABLE void addkj(QString id, QString numv,QString type);
    Q_INVOKABLE void kjchange(QString id, double mbwz,QString kswz);
    Q_INVOKABLE void copyypz(QString copyid);
    Q_INVOKABLE int getdef(int id);
    Q_INVOKABLE void setdef(int id);
    Q_INVOKABLE void addkjchange(QString id, double mbwz,QString type);
    Q_INVOKABLE QJsonArray getdeff(int val);
    Q_INVOKABLE void updatadeff(int id, int num, QString name,QString namev);
    Q_INVOKABLE void adddeff(int id);
    Q_INVOKABLE void deldeff(int id, int num);
    Q_INVOKABLE void delnulldeff();
    Q_INVOKABLE void defset(int id, int num);
    Q_INVOKABLE QStringList getzsqdef();
    Q_INVOKABLE QStringList getggdef();
    Q_INVOKABLE QString getDistance(QString,QString,QString,QString);
    Q_INVOKABLE QString getVolume(QString,QString,QString,QString);
    Q_INVOKABLE void resetAllSyringe(QString);
    Q_INVOKABLE QString getSyringType(QString,QString);

    Q_INVOKABLE int   getSyringeNumByConsumableName(QString consumableName);      // 根据耗材名称获取注射器的数量-JNN

    int shunxunumb=1;
    Q_INVOKABLE QString rsyty(int id);
    Q_INVOKABLE  QStringList gethclxdef();
    Q_INVOKABLE QStringList zpgethclxdef();
    QString getSyringTypezsq(QString ConsumablesTypes, QString serial);

    Q_INVOKABLE int exportExeConfig(QString);
    Q_INVOKABLE int importExeConfig();

signals:
    void updatatab(int id,QString name,QString type,QString path);
    void addlist();
    void dellist();
    void uplist();
    void updef();
    void save();
    void rename();
    void defrename();

private:
    UdpClient *udpClient;
    CommonHelper *common;
};

#endif // EXECONFIG_H
